#include<iostream>
#include<algorithm>
#include<vector>

using std::vector;
using std::pair;
using std::make_pair;
using std::swap;
using std::cin;
using std::cout;

template<typename T>
void Input(vector<T> &v, vector<T> &help) {
    size_t size;
    cin >> size;
    v.resize(size);
    help.resize(size);
    for (size_t i = 0; i < size; ++i) {
        cin >> v[i];
    }
}

template<typename T>
void Split(pair <T, T> input1, pair<T, T> input2, T res)
{
    while (input1.first != input1.second && input2.first != input2.second) {
        if (*input1.first < *input2.first) {
            *res = *input1.first;
            ++res;
            ++input1.first;
        }
        else {
            *res = *input2.first;
            ++res;
            ++input2.first;
        }
    }
    while (input1.first != input1.second) {
        *res = *input1.first;
        ++res;
        ++input1.first;
    }

    while (input2.first != input2.second) {
        *res = *input2.first;
        ++res;
        ++input2.first;
    }
}

template<typename T>
void Merge(vector<T> &start, int l, int r, vector<T> &help) {
    if (r <= l) {
        return;
    }

    Merge(start, l, (l + r) / 2, help);
    Merge(start, (l + r) / 2 + 1, r, help);

    auto first = make_pair(start.begin() + l, start.begin() + (l + r) / 2 + 1);
    auto second = make_pair(start.begin() + (l + r) / 2 + 1, start.begin() + r + 1);

    Split(first, second, help.begin() + l);

    for (int i = l; i <= r; ++i)
        start[i] = help[i];
}

template<typename T>
void Output(const vector<T> &v) {
    for (auto elem : v) {
        cout << elem << " ";
    }
}
int main() {
    vector<int> v, help;

    Input(v, help);
    Merge(v, 0, v.size() - 1, help);
    Output(v);
}